<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Mockery\Exception;

/**
 * Class Store
 *
 * @package App
 * @mixin \Eloquent
 */
class Store extends Model
{

    public $timestamps = false;
    protected $table = 'jkbl_config';


    /**
     * 普通商户权限设置
     * @param $request
     * @return array
     */
    static function ModifyStoreConfig($request)
    {
        try {
            $config = Store::first();
            foreach (['title', 'circle', 'docnum', 'shownum', 'coupon', 'keeptime', 'scanuser', 'qunsend'] as $value) {
                $config->$value = $request->$value;
            }
            if (!$config->save()) {
                return error('修改失败');
            }
        } catch (Exception $e) {
            return error('修改失败');
        }
        return success('成功');
    }
}
